﻿using STMS.Models.VModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace STMS.DAL
{
    public class ViewProductStoreDAL:BQuery<ViewProductStoreInfo>
    {
        /// <summary>
        /// 获取商品库存列表
        /// </summary>
        /// <param name="storeId"></param>
        /// <param name="regionId"></param>
        /// <param name="productId"></param>
        /// <returns></returns>
        public List<ViewProductStoreInfo> GetProductStoreList(int storeId, int regionId, int productId)
        {
            string strWhere = "IsDeleted=0";
            if (storeId > 0)
                strWhere += $" and StoreId={storeId}";
            if (regionId > 0)
                strWhere += $" and SRegionId={regionId}";
            if (productId > 0)
                strWhere += $" and ProductId={productId}";
            string cols = CreateSql.GetColsString<ViewProductStoreInfo>("IsDeleted,Id");
            return GetModelList(strWhere, cols);
        }

    }
}
